﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DbSupportLib;

namespace Contributor.Data_Objects
{
    public class Person
    {
        public int PersonID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime DOB { get; set; }
        public bool HeadOfHousehold { get; set; }

        public static List<Person> LoadForEntity(int entityID)
        {
            List<Person> people = new List<Person>();

            string cmdStr = string.Format(@" 
SELECT PersonID, FirstName, LastName, DOB, HeadOfHousehold
FROM dbo_Person p
WHERE EntityID={0}
ORDER BY HeadOfHousehold", entityID);

            return DbSupportLib.Support.QueryToList(people, AppConfig.DbConnection, System.Data.CommandType.Text, cmdStr);
        }
    }
}
